package zucc.edu.cn.chengchengparttime.My;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.ImageView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatButton;

import java.util.ArrayList;
import java.util.List;

import zucc.edu.cn.chengchengparttime.LoginAndReg.LoginActivity;
import zucc.edu.cn.chengchengparttime.LoginAndReg.RegisterActivity;
import zucc.edu.cn.chengchengparttime.MainActivity;
import zucc.edu.cn.chengchengparttime.R;

public class MyAppSetting extends AppCompatActivity implements View.OnClickListener{
    private Context context;
    private List<String> data=new ArrayList<>(); //数据列表

    private AppCompatButton btn_logout;
    private ImageView goback;
    private ImageView nextpage;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_my_appsetting);
        context = this.getBaseContext();

        btn_logout=findViewById(R.id.btn_logout);
        nextpage=findViewById(R.id.next1);
        goback=findViewById(R.id.goback);

        btn_logout.setOnClickListener(this);
        nextpage.setOnClickListener(this);
        goback.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_logout://返回登录界面
                Toast.makeText(this.context, "点击了退出登录按钮" , Toast.LENGTH_SHORT).show();
                Intent intent2 = new Intent(MyAppSetting.this, LoginActivity.class);
                startActivity(intent2);
                finish();
                break;
            case R.id.next1://返回登录界面
                Toast.makeText(this.context, "点击了账号与安全" , Toast.LENGTH_SHORT).show();
                //跳转到账号与安全界面
                Intent intent1 = new Intent(MyAppSetting.this, MyAppSetting_AccountSecurity.class);
                startActivity(intent1);
                finish();
                break;
            case R.id.goback://返回登录界面
                Toast.makeText(this.context, "点击了返回" , Toast.LENGTH_SHORT).show();
                //跳转到用户设置界面（首先要跳转到MainActivity，然后跳转到MyFragment）
                Intent i=new Intent();
                i.setClass(MyAppSetting.this, MainActivity.class);
                //一定要指定是第几个pager，这里填写3
                i.putExtra("id",3);
                startActivity(i);
                break;
        }
    }
}
